<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>查询</title>



</head>
<body>

<div style="height: auto; width: auto">
    <table>
        <tr  th:each="user,infoStat : ${listuser}" >

            <p th:text="${infoStat.index}+' 昵称: ' + ${user.userName}+
' 年级: ' + ${user.grade}+
' 专业: ' + ${user.major}+
' 微信: ' + ${user.vx}+
' 爱情宣言: ' + ${user.introduce}

"  ></p>


            <button class="btn" th:onclick="'del(\''+${user.uid}+'\');'"
            onclick="del(1)"
            >del</button>

        </tr>


    </table>




</div>
</body>
<!--<script type="text/javascript"  src="../static/config.js" />-->
<script type="text/javascript">
    const  bashUrl="http://www.zhisoft.work:8080/love/"
    // const  bashUrl="http://localhost:8080/love/"
function del(uid) {


    if(uid){
        var httpRequest = new XMLHttpRequest();//第一步：建立所需的对象
        httpRequest.open('GET', bashUrl+'del/?id='+uid, true);//第二步：打开连接  将请求参数写在url中  ps:"./Ptest.php?name=test&nameone=testone"
        httpRequest.send();//第三步：发送请求  将请求参数写在URL中
        /**
         * 获取数据后的处理程序
         */
        httpRequest.onreadystatechange = function () {
            if (httpRequest.readyState == 4 && httpRequest.status == 200) {
                alert("删除成功");
                location.reload(true);

            }
        };

  }

}

</script>

</html>